home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / manual-p / man_db-2.000 / man_db-2 / man_db-2.3.10 / aclocal.m4 < prev    next >
Encoding:
M4 Source File  |  1995-03-27  |  1.9 KB  |  97 lines

  1. dnl
  2. dnl Check to see if sprintf() returns the number of chars converted
  3. dnl Take no arguments
  4. dnl
  5. AC_DEFUN(MAN_FUNC_ANSI_SPRINTF,
  6. [AC_MSG_CHECKING(for ANSI C sprintf)
  7.  
  8. AC_CACHE_VAL(man_cv_func_ansi_sprintf,
  9. [AC_TRY_RUN(
  10. changequote(<<, >>)dnl
  11. <<int main(void)
  12. {char str[12];
  13. if ((int)sprintf(str,"test_string")==11) exit(0);
  14. exit(1);
  15. }>>,
  16. changequote([, ])dnl
  17. man_cv_func_ansi_sprintf=yes, 
  18. [man_cv_func_ansi_sprintf=no],
  19. [man_cv_func_ansi_sprintf=no])dnl
  20. ])
  21.  
  22. test "$man_cv_func_ansi_sprintf" = "yes" && AC_DEFINE(ANSI_SPRINTF)
  23.  
  24. AC_MSG_RESULT($man_cv_func_ansi_sprintf)
  25. ])
  26.  
  27. dnl
  28. dnl Check to see if nroff is GNU nroff, take nroff path as arg.
  29. dnl
  30. AC_DEFUN(MAN_PROG_GNU_NROFF,
  31. [AC_MSG_CHECKING(whether nroff is GNU nroff)
  32.  
  33. AC_CACHE_VAL(man_cv_prog_gnu_nroff,
  34. [if test `echo "\\n(.g" | $1 | tr -d '\n'` -eq 1
  35. then
  36.     man_cv_prog_gnu_nroff=yes
  37. else
  38.     man_cv_prog_gnu_nroff=no
  39. fi])
  40.  
  41. if test "$man_cv_prog_gnu_nroff" = "yes" 
  42. then
  43.     AC_DEFINE(GNU_NROFF)
  44. fi
  45. AC_MSG_RESULT($man_cv_prog_gnu_nroff)
  46. ])
  47. dnl
  48. dnl Check to see if popen/pclose correctly handles multiple streams
  49. dnl
  50. AC_DEFUN(MAN_FUNC_PCLOSE,
  51. [AC_MSG_CHECKING(for working pclose)
  52.  
  53. AC_CACHE_VAL(man_cv_func_pclose,
  54. [AC_TRY_RUN(
  55. [#include <stdio.h>
  56. #include <sys/wait.h>
  57. int
  58. try_pclose (FILE *f, int expected)
  59. {
  60.   int s;
  61.   s = pclose (f);
  62.   if (s != -1 && WIFEXITED (s))
  63.     return WEXITSTATUS (s) != expected;
  64.   else 
  65.     return 1;
  66. }
  67. int
  68. main (void)
  69. {
  70.   FILE *f, *t;
  71.   int i, sf, st;
  72.   for (i = 0;  i <= 1;  ++i) {
  73.     f = popen ("false", "r");
  74.     sleep (1);
  75.     t = popen ("true", "r");
  76.     sleep (1);
  77.     if (i) {
  78.       st = try_pclose (t, 0);
  79.       sf = try_pclose (f, 1);
  80.     } else {
  81.       sf = try_pclose (f, 1);
  82.       st = try_pclose (t, 0);
  83.     }
  84.     if (sf || st) exit(1);
  85.   }
  86.   exit(0);
  87. }],
  88. man_cv_func_pclose=yes,
  89. [man_cv_func_pclose=no],
  90. [man_cv_func_pclose=no])dnl
  91. ])
  92.  
  93. test "man_cv_func_pclose" = "no" && AC_DEFINE(BROKEN_PCLOSE)
  94.  
  95. AC_MSG_RESULT($man_cv_func_pclose)
  96. ])
  97.